#include "misc.h"
#include <ace/Time_Value.h>
void msprintf(char* buff, int length,  const char *pFormat, ...)
{
	va_list marker;
	va_start(marker, pFormat);
	int iCopy = _vsnprintf(buff, length, pFormat, marker);
	if(iCopy == -1 || iCopy == length)
	{
		char *p = buff + length - 4;
		memcpy(p, "...", 4);
	}
	va_end(marker);
}

long get_current_time()
{
	ACE_Time_Value tv = ACE_OS::gettimeofday();
	return tv.sec();
}
long get_current_time_with_ms(long& mseconds)
{
	ACE_Time_Value tv = ACE_OS::gettimeofday();
	mseconds = tv.usec() / 1000;
	return tv.sec();
}

set<MsAddr> one_addr(const MsAddr& addr)
{
	set<MsAddr> addrs;
	addrs.insert(addr);
	return addrs;
}
